<?php
    $queryTitle = isset($_GET["Title"])?$_GET["Title"]:null;
    $sql ="select * from 'article'";
    $hasWhere = false;
    $where ="";

    $queryTitle = isset($_GET["Title"])?$_GET["Title"]:null;
    if(quertyTitle){
        if(!$hasWhere){
            $sql .="WHERE";
            $hasWhere = true;
        }
        $where = "Title like('%$queryTitle%')";
        //$sql = $sql ."where Title like('%$queryTitle%')";
    }
    $conn = new mysql("localhost","root","","");
    $rows=[];
    $rs = $conn->query($sql);
    while($row = $rs->feach_assoc()){
        $rows[] = $row;
    }
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="texthtml;charset=utf8"/>
        <title>first page</title>
    </head>
    <body>
        <h3>文章列表</h3>
        <a href="article_add.php">新建文章</a>

        <form action="" method="">
            <div>
                <label>标题</label>
                <input type="text" name="Title" id="Title"/>


            </div>
            <div>
                <label>作者</label>
                <input type="text" name="Author" id="Title"/>


            </div>
            <input type=""/>



        </form>
        <table boder='1'>
            <thead>
                <tr>
                    <th>标题</th>
                    <th>作者</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($rows as $row){?>
                <tr>
                <td>
                    <?=$row["Title"]?>
                    我的第一篇博客
                </td>
                <td>
                <?=$row["Athor"]?>    
                </td>  
                <td>2020 3 24</td>  
                <td>详细 修改 删除</td>      
                <tr>
                <?php } ?>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="4">
                        共n条记录，12页当前为2页
                </tr>
            </tfoot>
        </table>
    </body>
<html>